#用递归算法解决汉诺塔问题
def hanoi(n, a, b, c):
    if(n == 1):
        print(a, '->', c)
    else:
        hanoi(n-1, a, c, b)
        print(a, '->', c)
        hanoi(n-1, b, a, c)
 
num = int(input('请输入汉诺塔的层数:'))
hanoi(num, 'a柱', 'b柱', 'c柱')